define([ "PDUtilDir/grid", "PDUtilDir/searchBlock" ], function(Grid,
		SearchBlock) {

	function init(cache, addObj, updateObj, delObj, addTicketObj, searchObj) {
		SearchBlock.init('searchBlockId');

		// 初始化
		return Grid({
			id : "DemoGirdDivId",
			pageSize : 10,
			index : true,
			multi : true,
			pagination : true,
			cache : false,
			layout : [ {
				name : "景点名称",
				field : "name",
				sort : true,
				click : function(e) {
					updateObj.run(e.data.row);
				}
			}, {
				name : "等级",
				field : "level",
				sort : true,
				format : function(obj) {
					return cache.typeMap.get(obj.row.level);
				}
			}, {
				name : "开放时间",
				field : "openTime",
				width : "10%"
			}, {
				name : "描述",
				field : "description"
			}, {
				name : "添加门票",
				field : "null",
				format : function(obj) {
					return "添加门票"
				},
				click : function(obj) {
					addTicketObj.run(obj.data.row.id);
				}
			} ],
			toolbar : [ {
				name : "添加",
				icon : "fa fa-plus-circle",
				callback : function(event) {
					addObj.run();
				}
			}, {
				name : "删除",
				icon : "fa fa-trash-o",
				callback : function(event) {
					delObj.run();
				}
			}, {
				name : "查询",
				icon : "fa fa-search",
				callback : function(event) {
					searchObj.run();
				}
			} ],
			data : {
				type : "URL",
				value : getServer()
						+ "/flea/hclv/spot/selectMySpotByDeptId.htmls"
			}
		});
	}
	return {
		init : init
	}
});